(function($){

    /*
     * 由于transform属性不能单个设置，目前仅能设置一个属性，日后研究下matrix；
     */
    $.fn.cssTranslate = function(xs, ys){
        this[0].style.webkitTransform  = 'translate3d('+xs+'px, '+ys+'px, 0)';
        return this;
    };

    $.fn.cssScale     = function(scale){
        var scale3d   = [
            'scale3d(',scale,',',scale,',',scale,')'
        ];
        this[0].style.webkitTransform  = scale3d.join('');
    };

    $.fn.getTranslate = function(){
        var $this     = $(this);
            reg       = /\d+\.?\d?/g;
            transform = $this.css('-webkit-transform'),
            transArr  = transform.match(reg),
            length    = transArr.length,
            pos       = {},
            indexX    = 4,
            indexY    = 5;
        if(transform.indexOf('3d') > 0){
            indexX    = 13;
            indexY    = 14;
        }
        pos           = {
            x  : parseInt(transArr[indexX]),
            y  : parseInt(transArr[indexY])
        };
        return pos;
    }
})(jQuery);
